Conventionally, a mechanical cam which operates in cooperation with the motion of a cam attached to a shaft has been used. Utilizing this mechanical cam, however, has the added difficulty of adjusting a cam pattern, therefore, an electronic cam has come into wide use. The electronic cam conducts the cam operation using a relationship between the rotation of the cam and cam configuration data which has been stored in advance. A rotation position of the shaft is detected before the servo motor is controlled on the basis of the detected value.
As seen in FIG. 15, a functional block diagram shows a conventional control apparatus for a servo system which controls an electronic cam. Cam shaft data 22 represents the rotary angle of a cam shaft within one revolution, where the shaft is assumed to be attached to a cam. A processing block 100, which represents the concept of the processing of the microprocessor within a motion command section, receives the cam shaft data 22 and processes a position command for executing the operation of the electronic cam. The processing block 100 contains a cam configuration data table, hereinafter referred to as a position command table 23, where cam configuration data has been stored. A position command 29 is output by the processing block 100. A second processing block 101 representing the concept of the processing of the microprocessor found within a servo drive section receives the position command 29. The second processing block 101 contains a position control processor 32, a velocity control processor 33 and a current control processor 34. The second processing block 101 receives current position information 35 of a motor to be controlled, velocity information 36 of the motor to be controlled and a current value 37 of the motor to be controlled. Finally, the second processing block 101 outputs a voltage command 38 for driving the motor to be controlled.
An arithmetic processor 80 within the second processing block 101 subtracts the current position information 35 from the position command 29 and outputs a value to the position control processor 32. An arithmetic processor 91 subtracts the velocity information 36 from a velocity command calculated and output by the position control processor 32. An arithmetic processor 92 subtracts the current value 37 from the current command calculated and output by the velocity control processor 33.
Turning to FIG. 16, there is shown one example of the position command table 23 in the conventional control apparatus for the servo system which controls the electronic cam. In the figure, position addresses 280 are stored which represent one revolution of the cam shaft, where one revolution of the cam shaft is divided at regular intervals, e.g., 2000 divisions which represent equally spaced angles, i.e., 2000 angles. Cam operation values 281 of the cam corresponding to the position addresses 280 are also stored. In this situation, the cam operation values 281 are positional values between 0 and 1 within one revolution of the cam shaft (0=top dead center of a cam operation stroke, 1=bottom dead center of the same).
The operation of the motion command section will now be described. As seen in FIG. 17, a flowchart represents the processing of the motion command section in the conventional control apparatus for the servo system which controls the electronic cam.
The current position information 35 of the cam shaft is received in step S201.
Next, the position information of the cam within one revolution is obtained from the cam shaft data represented by the remainder resulting from the current position of the cam shaft by one revolution value (360.degree.) in step S202.
Subsequently, referring to the position command data table 23, the cam operation value 281 corresponding to the cam shaft data is obtained in step S203 (the details will be described in FIG. 18).
The position command for continuously conducting the reciprocating motion of the cam is calculated as (h.sub.1 .times.D)+h.sub.2 from the cam operation value D corresponding to the rotation position information A of the cam shaft, a stroke value setting value h.sub.1 and a stroke lower limit position setting value h.sub.2 which have been previously stored in a region for a variable in step S204. This is a motion of reciprocation between the lower position setting value h.sub.2 and the upper limit position (h.sub.1 +h.sub.2) of the cam motion.
The position command 29 is outputted to the servo drive section in step S205.
A flowchart representing the calculating of the operation value of the cam corresponding to the rotation position information of the cam shaft is shown in FIG. 18. The motion command section in the conventional control apparatus for the servo system controls the electronic cam as shown in this flowchart.
In step S1170, A.sub.1 and A.sub.2 closest to A, among the position addresses within one revolution of the cam shaft, where A.sub.1 .ltoreq.A&lt;A.sub.2, is searched from the position command data table 23. The rotation position information A of the cam shaft was calculated in step S202 of FIG. 17.
Thereafter, the cam motion values corresponding to the position addresses A.sub.1 and A.sub.2 within one revolution are obtained from the position command table in step S1171, indicated by D.sub.1 and D.sub.2 in FIG. 16.
The cam motion value D corresponding to the rotation position information A of the cam shaft is calculated from the position addresses A.sub.1 and A.sub.2 and the cam motion value D.sub.1 and D.sub.2 within one revolution in step S1172 on the basis of the following formula. EQU D=D.sub.1 +(D.sub.2 -D.sub.1).times.{(A-A.sub.1)/(A.sub.2 -A.sub.1)}
This is to make a proportional distribution calculation on the basis of the position address within one revolution because the cam motion value stored in the cam configuration data table is discrete with respect to the position address within one revolution of the cam shaft.
Next, the operation of the servo drive section will be described. As seen in FIG. 19, a flowchart represents the processing of the position control processor 32 in the second processing block 101 within the servo drive section of FIG. 15. Turning to FIG. 20, there is a flowchart representing the processing of the velocity control processor 33 in the second processing block 101. A flowchart representing the processing of the current control processor 34 in the second processing block 101 is shown in FIG. 21.
In step S101, the position control processor 32 receives a difference between the position command 29 outputted from the motion command section 100 and the motor current position information 35. A motor travel velocity is calculated from the difference between the current position information 35 and the position command 29 in step S102. The calculated motor travel velocity (velocity command) is outputted to the velocity control processor 33 in step S103.
In the velocity control processor 33, a difference between the velocity command calculated by the position control processor 32 and the motor velocity data 36 is received in step S104. Current given to the motor is calculated from the difference between the motor velocity data 36 and the velocity command in step S105. The calculated current value (current command) is outputted to the current control processor 34 in step S106.
As shown in the flowchart of FIG. 21, the current control processor 34 receives a difference between the current command calculated by the velocity control processor 33 and the motor current data 37 in step S107. A voltage command 38 output to a PWM power circuit is calculated from the difference between the current data 37 and the current command in step S108. The calculated voltage command 38 is outputted to the PWM power circuit section (not shown) within the servo drive section in step S109. The PWM power circuit section drives the motor by controlling the current to the motor on the basis of the voltage command 38.